function PatchTestT3
clc
%close all
addpath('../');
addpath('../../');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% mesh
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% l = 200;
% h = 200;

l = 1;
h = 1;

nodes = [ 0 0;
    l 0;
    l h;
    0 h ];
connectivities = [ 1 2 3;
    1 3 4];
mesh = createMesh(nodes,connectivities);
%mesh.printMyself();
%plotMesh(mesh);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% conditions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% du = 1e-2;
% lambda = [1.159 1.59+1e-4*linspace(1,2,2)];

du = 0.5;
%lambda = [0.9 0.92:0.01:1]; %for testing
lambda = 0:0.01:2; %for plotting the resistant-displacement curve

constraint = [  1 0 0 0.0 0.0;
    2 0 0 du 0.0;
    3 0 1 du 0.0;
    4 0 1 0.0 0.0   ];
setConstraints(mesh,constraint);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% element declaration; custom section
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
M = fem2.Model(mesh);
nf = mesh.countFaces();

E = 2;
nu = 0.3;
ft = 0.91;
C = C_plane_stress(E,nu);
Dnn = 1;
Dss = 1;
ef = 3;
Gf = ef*ft;

% E = 50e9;
% nu = 0.2;
% ft = 2.9e6;
% C = C_plane_stress(E,nu);
% Gf = 7000;
% ef = Gf/ft;
% Dnn = 1e6;
% Dss = 1e6;

for i=1:nf
    e = fem2.MatlabStructuralElement(mesh.getFace(i-1));
    M.addElement(e);
    %create struct to contain element state variables
    es = createElementContainer();
    es.constitutiveMatrix = C;
    es.Dnn = Dnn;
    es.Dss = Dss;
    es.Gf = Gf;
    es.ef = ef;
    es.ft = ft;
    elements(i) = es;
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% solve
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
postProcessInfo.infoList = {'resistant force',...
    'crack opening Jirasek','damage parameter Jirasek',...
    'check sigma1'};
postProcessInfo.infoParam = {[1 4],[],[]};

[elements,output] = solving_strategy_static_2(elements,M,...
    lambda,50,1e-6,postProcessInfo);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% post processing
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
res_node_1(:,:) = -output.resistant_force(:,1,:);
delta = lambda*du;
plot(delta,res_node_1);

plotMeshWithCrack(M,elements,{'trimesh','conditions','id'});
plotDeformedMesh(mesh,1);

rmpath('../');
rmpath('../../');
end
